# 导入包
from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep
# 获取浏览器驱动
driver = webdriver.Firefox()
driver.maximize_window()
# 打开测试的页面
url = 'file:///root/NSD2408/html/register.html'
driver.get(url)

# 输入用户名
driver.find_element(By.CSS_SELECTOR, '#user').send_keys('admin')
sleep(3)
# 6.刷新浏览器
driver.refresh()
# 7.获取网页的标题
title = driver.title
print('网页标题：', title)
# 8.获取网页的网址
url = driver.current_url
print('网址：', url)

driver.find_element(By.PARTIAL_LINK_TEXT, '新浪').click()
# 9.关闭主窗口
sleep(3)
driver.close()

# 10.关闭浏览器，关闭所有窗口
sleep(3)
driver.quit()